jtr.cc sbp.cc sbn.cc mmo.cc skyforce.cc itracku.cc v900.cc delbin.cc \
pocketfms_bc.cc pocketfms_fp.cc pocketfms_wp.cc naviguide.cc enigma.cc \
vpl.cc teletype.cc jogmap.cc bushnell.cc bushnell_trl.cc wintec_tes.cc \
- subrip.cc garmin_xt.cc explorist_ini.cc \
+ subrip.cc garmin_xt.cc \
-ALL_FMTS=$$MINIMAL_FMTS
+# ALL_FMTS=$$MINIMAL_FMTS
FILTERS=position.cc radius.cc duplicate.cc arcdist.cc polygon.cc smplrout.cc \
reverse_route.cc sort.cc stackfilter.cc trackfilter.cc discard.cc \
nukedata.cc interpolate.cc transform.cc height.cc swapdata.cc
SOURCES += $$ALL_FMTS $$FILTERS $$SUPPORT $$SHAPE $$ZLIB $$JEEPS
# We don't care about stripping things out of the build. Full monty, baby.
-#DEFINES += MAXIMAL_ENABLED
+DEFINES += MAXIMAL_ENABLED
DEFINES += FILTERS_ENABLED
-#DEFINES += PDBFMTS_ENABLED
-#DEFINES += SHAPELIB_ENABLED
-#DEFINES += CSVFMTS_ENABLED
-#DEFINES += CET_WANTED
+DEFINES += PDBFMTS_ENABLED
+DEFINES += SHAPELIB_ENABLED
+DEFINES += CSVFMTS_ENABLED
+DEFINES += CET_WANTED
int i = 0;
for (i = 0; i < (sizeof(default_guids)/sizeof(struct defguid)); i++) {
if (!memcmp(guid, &default_guids[i].guid, sizeof(GUID))) {
- *name = default_guids[i].name;
+ *name = (char*) default_guids[i].name;
return 1;
}
}
#define MYNAME "BRAUNIGER-IQ"
#define PRESTRKNAME "PRESALTTRK"
-static enum {
+typedef enum {
st_sync,
st_fl_num,
st_data_len,
st_sample_alt,
st_sample_spd,
num_states
-} state;
+} state_t;
+state_t state;
+#if __cplusplus
+inline state_t operator++(state_t& rs, int)
+{
+ return rs = (state_t)((int)rs + 1);
+}
+#endif
static const int reqd_bytes[num_states] = { 6, 1, 2, 2, 25, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 1 };
if ((wpt->description) && ((strlen(wpt->description) > MAX_MARKER_NAME_LENGTH) || (strcmp(wpt->description, wpt->shortname)))) {
if ((wpt->notes) && (strcmp(wpt->description, wpt->notes) != 0)) {
- notes = xcalloc(strlen(wpt->description) + strlen(wpt->notes) + 9, 1);
+ notes = (char*) xcalloc(strlen(wpt->description) + strlen(wpt->notes) + 9, 1);
sprintf(notes, "%s\nNotes:\n%s", wpt->description, wpt->notes);
} else {
notes = xstrdup(wpt->description);
if (notes != NULL) {
size += strlen(notes);
}
- rec = xcalloc(size, 1);
+ rec = (struct record_wpt*) xcalloc(size, 1);
pdb_write_double(&rec->lon, RAD(-wpt->longitude));
pdb_write_double(&rec->lat, RAD(wpt->latitude));
ff_vecs_t coto_vecs = {
ff_type_file,
- {ff_cap_read|ff_cap_write, ff_cap_read, ff_cap_none},
+ {(ff_cap)(ff_cap_read|ff_cap_write), ff_cap_read, ff_cap_none},
rd_init,
wr_init,
rd_deinit,
chksum = checksum(p + 2, 6);
le_write16(p + 8, chksum);
// message data (filled in by caller)
- chksum = checksum(m->data, m->size);
+ chksum = checksum((gbuint8*) m->data, m->size);
n = 2 + 8 + m->size;
// trailer (checksum and marker bytes)
le_write16(p + n, chksum);
m->buf[0] = m->buf[1] = 0;
memcpy(m->buf + 2, buf, 8);
// read message body and trailer
- read_depacketize(m->data, total);
+ read_depacketize((gbuint8*) m->data, total);
p = (gbuint8*)m->data + m->size;
- if (checksum(m->data, m->size) == le_readu16(p) &&
+ if (checksum((gbuint8*) m->data, m->size) == le_readu16(p) &&
p[2] == 0xad && p[3] == 0xbc) {
if (global_opts.debug_level >= DBGLVL_M) {
warning(MYNAME ": received %x\n", id);
return success;
}
-static struct {
+typedef struct {
unsigned msg_id;
message_t msg;
-}* batch_array;
+} batch_array_t;
+
+static batch_array_t* batch_array;
+
static unsigned batch_array_max;
static unsigned batch_array_i;
add_to_batch(unsigned id, message_t* m)
{
if (batch_array_i == batch_array_max) {
- void* old = batch_array;
+ char* old = (char*) batch_array;
if (batch_array_max == 0) {
batch_array_max = 50;
}
batch_array_max += batch_array_max;
- batch_array = xmalloc(batch_array_max * sizeof(*batch_array));
+ batch_array = (batch_array_t*) xmalloc(batch_array_max * sizeof(*batch_array));
if (batch_array_i) {
memcpy(batch_array, old, batch_array_i * sizeof(*batch_array));
xfree(old);
thread_func(void* run_loop_source)
{
run_loop = CFRunLoopGetCurrent();
+#if __cplusplus
+ CFRunLoopAddSource(run_loop, (__CFRunLoopSource*) run_loop_source, kCFRunLoopDefaultMode);
+#else
CFRunLoopAddSource(run_loop, run_loop_source, kCFRunLoopDefaultMode);
+#endif
CFRunLoopRun();
return NULL;
}
fatal(MYNAME ": IOCreatePlugInInterfaceForService failed 0x%x\n", (int)kr);
}
IOObjectRelease(service);
- hr = (*plugin)->QueryInterface(plugin, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (void*)&device);
+ hr = (*plugin)->QueryInterface(plugin, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (void**)&device);
if (hr) {
fatal(MYNAME ": QueryInterface failed 0x%x\n", (int)hr);
}
wpt->microseconds = ((int)time % 1000) * 1000;
if (wpt->fix > 0) {
- wpt->fix++;
+ wpt->fix = (fix_type)(wpt->fix + 1);
}
if (! trk) {
unknown_header
} header_type;
+#if __cplusplus
+inline header_type operator++(header_type& rs, int)
+{
+ return rs = (header_type)((int)rs + 1);
+}
+
+inline gt_display_modes_e operator++(gt_display_modes_e& rs, int)
+{
+ return rs = (gt_display_modes_e)((int)rs + 1);
+}
+#endif
+
#define MAX_HEADER_FIELDS 36
static char* header_lines[unknown_header + 1][MAX_HEADER_FIELDS];
xfree(wpt_a);
route_idx = 0;
- route_info = xcalloc(route_count(), sizeof(struct info_s));
+ route_info = (info_t*) xcalloc(route_count(), sizeof(struct info_s));
routepoints = 0;
route_disp_all(prework_hdr_cb, prework_tlr_cb, prework_wpt_cb);
if (routepoints > 0) {
}
route_idx = 0;
- route_info = xcalloc(track_count(), sizeof(struct info_s));
+ route_info = (info_t*) xcalloc(track_count(), sizeof(struct info_s));
routepoints = 0;
track_disp_all(prework_hdr_cb, prework_tlr_cb, prework_wpt_cb);
/* make a copy of headers[ht], uppercase, replace "\t" with "\0" */
i = strlen(headers[ht]);
- fields = xmalloc(i + 2);
+ fields = (char*) xmalloc(i + 2);
strcpy(fields, headers[ht]);
strcat(fields, "\t");
c = strupper(fields);
memset(&header_ct, 0, sizeof(header_ct));
datum_index = -1;
- grid_index = -1;
+ grid_index = (grid_type) -1;
init_date_and_time_format();
}
static int
-gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, void* data)
+gcdb_add_to_rec(struct dbrec* rec, const char* fldname, gcdb_rectype rectype, const void* data)
{
int length;
static int rec_cnt;
if (!tbuf) {
-tbuf = xcalloc(MAXRECSZ, 1);
+tbuf = (char*) xcalloc(MAXRECSZ, 1);
tbufp = tbuf;
}
switch (rectype) {
case RECTYPE_TEXT:
-length = 1 + strlen(data);
+length = 1 + strlen((const char*)data);
be_write16(&rec->dbfld[rec_cnt].fldlen, length);
-strcpy(tbufp, data);
+strcpy(tbufp, (const char*)data);
tbufp += (length + 1) & (~1);
break;
case RECTYPE_DATE:
* We don't really know how many fields we'll have or how long
* they'll be so we'll just lazily create a huge place to hold them.
*/
-rec = xcalloc(sizeof(*rec) + 500, 1);
+rec = (struct dbrec*) xcalloc(sizeof(*rec) + 500, 1);
gcdb_add_to_rec(rec, "gcna", RECTYPE_TEXT, wpt->description);
gcdb_add_to_rec(rec, "gcid", RECTYPE_TEXT, wpt->shortname);
/*
* We're done. Build the record.
*/
-reclen = gcdb_add_to_rec(rec, NULL, 0, NULL);
+reclen = gcdb_add_to_rec(rec, NULL, (gcdb_rectype)0, NULL);
pdb_write_rec(file_out, 0, 2, ct++, rec, reclen);
xfree(rec);
#if GDB_DEBUG
sn = xstrdup(nice(res->shortname));
#endif
- wpt_class = FREAD_i32;
+ wpt_class = (gt_waypt_classes_e) FREAD_i32;
GMSD_SET(wpt_class, wpt_class);
if (wpt_class != 0) {
waypth_ct++;
return NULL;
}
- dbuf = dp = xmalloc(len);
+ dbuf = dp = (char*) xmalloc(len);
while (len) {
char ch;
}
eof:
*dp++ = 0;
- dbuf = xrealloc(dbuf, dp - dbuf);
+ dbuf = (char*) xrealloc(dbuf, dp - dbuf);
/* fprintf(stderr, "<%.8s> dbuf=%x, len=%d\n", *pp, dbuf, len); */
*pp = p;
*lenp = len;
char* buf, *d;
if (!s) {
- d = xmalloc(1);
+ d = (char*) xmalloc(1);
*d = 0;
return d;
}
- buf = d = xmalloc(strlen(s) * 2 + 1);
+ buf = d = (char*) xmalloc(strlen(s) * 2 + 1);
for (; *s; ++s) {
/*
break;
}
- buf = xmalloc(bufsz);
+ buf = (signed char*) xmalloc(bufsz);
while ((len = gbfread(buf, 1, bufsz, fin))) {
int deg, min;
waypoint* wpt = (waypoint*) elem;
if (prev != NULL) {
- draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, 9 /* color */, prev);
+ draw_symbol_basics(OVL_SYMBOL_TRIANGLE, 1, (OVL_COLOR_TYP)9 /* color */, prev);
gbfprintf(fout, "Width=12\n");
gbfprintf(fout, "Height=8\n");
} else {
/* name in the form TRACKNAME #n */
snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", trk_seg_num);
- track_head->rte_name = xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
+ track_head->rte_name = (char*) xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
sprintf(track_head->rte_name, "%s #%s", trk_name, trk_seg_num_buf);
}
trk_seg_num++;
} else {
/* name in the form TRACKNAME #n */
snprintf(trk_seg_num_buf, sizeof(trk_seg_num_buf), "%d", trk_seg_num);
- track_head->rte_name = xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
+ track_head->rte_name = (char*) xmalloc(strlen(trk_name)+strlen(trk_seg_num_buf)+3);
sprintf(track_head->rte_name, "%s #%s", trk_name, trk_seg_num_buf);
}
trk_seg_num++;
char* vdata;
int lat, lon;
- rec = xcalloc(sizeof *rec, 1);
+ rec = (struct record*) xcalloc(sizeof *rec, 1);
vdata = (char*)rec + sizeof(*rec);
rec->header.type = 4;
ff_vecs_t gpilots_vecs = {
ff_type_file,
- { ff_cap_read | ff_cap_write, ff_cap_read | ff_cap_write, ff_cap_none},
+ { (ff_cap)(ff_cap_read | ff_cap_write), (ff_cap)(ff_cap_read | ff_cap_write), ff_cap_none},
rd_init,
wr_init,
rd_deinit,
gbfclose(file_in);
}
+typedef enum { id, takeoff, start, turnpoint, finish, landing } state_t;
+#if __cplusplus
+inline state_t operator++(state_t& rs, int)
+{
+ return rs = (state_t)((int)rs + 1);
+}
+#endif
+
/**
* Handle pre- or post-flight task declarations.
* A route is created for each set of waypoints in a task declaration.
char short_name[8];
char tmp_str[MAXRECLEN];
struct tm tm;
-
- static enum { id, takeoff, start, turnpoint, finish, landing } state = id;
+ static state_t state = id;
// First task record identifies the task to follow
if (id == state) {
/* now we are looking for a sequence like 0,1 NE (123456,654321) */
- buff = xmalloc(strlen(cin) + 1); /* safe target space for sscanf( ... */
+ buff = (char*) xmalloc(strlen(cin) + 1); /* safe target space for sscanf( ... */
comma = cin;
while ((comma = strchr(comma, separator))) {
struct tm* tm = NULL;
int date;
- char* cbuf = xmalloc(SZ);
+ char* cbuf = (char*) xmalloc(SZ);
cbuf[0] = '\0';
if (t > 0) {
mkshort_from_wpt(mkshort_handle, wpt) :
wpt->shortname;
- rec = xcalloc(sizeof(*rec)+56,1);
+ rec = (struct record*) xcalloc(sizeof(*rec)+56,1);
tm = NULL;
if (wpt->creation_time) {
queue* elem, *tmp;
char* tname;
int i;
- mapsend_hdr hdr = {13, "4D533334 MS", "30", ms_type_track, {0, 0, 0}};
+ mapsend_hdr hdr = {13, {'4','D','5','3','3','3','3','4',' ','M','S'},
+ {'3','0'}, ms_type_track, {0, 0, 0}
+ };
switch (trk_version) {
case 20:
static void
mapsend_wpt_write(void)
{
- mapsend_hdr hdr = {13, {"4D533330 MS"}, {"30"}, ms_type_wpt, {0, 0, 0}};
+ mapsend_hdr hdr = {13, {'4','D','5','3','3','3','3','0',' ','M','S'},
+ {'3', '0'}, ms_type_wpt, {0, 0, 0}
+ };
int n = 0;
int wpt_count = waypt_count();
#define MPSDESCBUFFERLEN 4096
-char* snlen = NULL;
-char* snwhiteopt = NULL;
-char* mpsverout = NULL;
-char* mpsmergeouts = NULL;
-int mpsmergeout;
-char* mpsusedepth = NULL;
-char* mpsuseprox = NULL;
+static char* snlen = NULL;
+static char* snwhiteopt = NULL;
+static char* mpsverout = NULL;
+static char* mpsmergeouts = NULL;
+static int mpsmergeout;
+static char* mpsusedepth = NULL;
+static char* mpsuseprox = NULL;
static
arglist_t mps_args[] = {
} else if (!strcmp(ap[1], "moving_travelling")) {
wpt_tmp->icon_descr = "Geocache-moving";
} else {
- xasprintf(&wpt_tmp->icon_descr,
+ // WARNING: casting away const-ness.
+ xasprintf((char**)&wpt_tmp->icon_descr,
"Geocache-%-.20s", ap[1]);
}
} else if (0 == strcmp(ap[0], "hidden_date")) {
}
/*------------------------------------------*/
-void ovl_read_parameter(char* fname)
+void ovl_read_parameter(const char* fname)
{
gbfile* fpin;
arglist_t* p;
struct doc_record0 *rec0;
--ct;
- rec0 = xcalloc(1, sizeof(struct doc_record0)+(ct-1)*sizeof(short));
+ rec0 = (struct doc_record0*) xcalloc(1, sizeof(struct doc_record0)+(ct-1)*sizeof(short));
be_write16(&rec0->version, COMPRESSED);
be_write16(&rec0->reserved1, 0);
be_write32(&rec0->doc_size, offset);
static void commit_buffer(void)
{
- struct recordsize *newrec = xcalloc(1, sizeof(struct recordsize));
+ struct recordsize *newrec = (struct recordsize*) xcalloc(1, sizeof(struct recordsize));
newrec->next = recordsize_tail;
newrec->size = buf.len;
recordsize_tail = newrec;
len = strlen(dest) + strlen(tmp) + 1;
if (len > *size) {
*size = len;
- res = xrealloc(dest, *size);
+ res = (char*) xrealloc(dest, *size);
} else {
res = dest;
}
tmp = str_pool[str_poolp];
if (str_pool_s[str_poolp] == 0) {
- tmp = xmalloc(size);
+ tmp = (char*) xmalloc(size);
} else if (str_pool_s[str_poolp] < size) {
- tmp = xrealloc(tmp, size);
+ tmp = (char*) xrealloc(tmp, size);
} else {
return tmp;
}
double altfeet;
struct tm tm;
- while (pdb_read_rec(file_in, NULL, NULL, NULL, (void *)&data) >= 0) {
+ while (pdb_read_rec(file_in, NULL, NULL, NULL, (void **)&data) >= 0) {
waypoint *wpt_tmp = waypt_new();
int line = 0;
char *tmp = data;
int len;
struct tm tm;
- buff = xcalloc(REC_SIZE, 1);
+ buff = (char *) xcalloc(REC_SIZE, 1);
if (wpt->latitude < 0) {
latdir = 'S';
* if (global_opts.objective != wptdata) / * Waypoint target do not need appinfo block * /
* {
*/
- appinfo = xcalloc(1, sizeof(*appinfo));
+ appinfo = (ppdb_appdata_t *) xcalloc(1, sizeof(*appinfo));
file_out->appinfo = (void *)appinfo;
file_out->appinfo_len = PPDB_APPINFO_SIZE;
/* }
res = (char *) xmalloc(count);
memcpy(res, buff, count);
} else {
- res = xrealloc(res, bytes + count);
+ res = (char*) xrealloc(res, bytes + count);
memcpy(&res[bytes], buff, count);
}
bytes += count;
}
if (res) {
- res = xrealloc(res, bytes + 1);
+ res = (char*) xrealloc(res, bytes + 1);
} else {
- res = xmalloc(1);
+ res = (char*) xmalloc(1);
}
res[bytes] = '\0';
for (i = 0; i < ct; i++) {
pdbrec_t *rec;
- rec = xcalloc(1, sizeof(*rec));
+ rec = (pdbrec_t*) xcalloc(1, sizeof(*rec));
if (fin->attr & PDB_FLAG_RESOURCE) {
(void) gbfgetuint32(fin->file); /* type */
rec->id = gbfgetint16(fin->file);
if (rec->next) {
rec->size = (gbint32)rec->next->offs - (gbint32)offs;
if (rec->size > 0) {
- rec->data = xmalloc(rec->size);
+ rec->data = (char*) xmalloc(rec->size);
rec->size = gbfread(rec->data, 1, rec->size, fin->file);
offs += rec->size;
} else if (rec->size < 0) {
pdb_invalid_file(fin, "Wrong data size in record with id %d.\n", rec->id);
}
} else {
- rec->data = pdb_read_tail(fin->file, &rec->size);
+ rec->data = (char*) pdb_read_tail(fin->file, &rec->size);
offs += rec->size;
}
}
{
pdbfile *res;
- res = xcalloc(1, sizeof(*res));
+ res = (pdbfile*) xcalloc(1, sizeof(*res));
res->file = gbfopen_be(filename, "rb", module);
res->mode = 1;
{
pdbfile *res;
- res = xcalloc(1, sizeof(*res));
+ res = (pdbfile*) xcalloc(1, sizeof(*res));
strncpy(res->name, "Palm/OS Database", PDB_DBNAMELEN);
res->file = gbfopen_be(filename, "wb", module);;
res->mode = 2;
{
pdbrec_t *rec, *cur;
- rec = xcalloc(1, sizeof(*rec));
+ rec = (pdbrec_t*) xcalloc(1, sizeof(*rec));
rec->category = category;
rec->flags = category;
rec->id = rec_id;
rec->size = size;
if (size > 0) {
- rec->data = xmalloc(size);
+ rec->data = (char*) xmalloc(size);
memcpy(rec->data, data, size);
}
wpt->pdop = le_read_float(&bc.espe);
wpt->course = le_read_float(&bc.course);
wpt->speed = le_read_float(&bc.speed);
- wpt->fix = (fix_type) le_readu16(&bc.fix) - 1;
+ wpt->fix = (fix_type) (le_readu16(&bc.fix) - 1);
track_add_wpt(trk_head, wpt);
}
poly_init(const route_head *h)
{
int ct = track_waypt_count();
- polybufx = xcalloc(ct, sizeof(double));
- polybufy = xcalloc(ct, sizeof(double));
- polybufz = xcalloc(ct, sizeof(double));
+ polybufx = (double*) xcalloc(ct, sizeof(double));
+ polybufy = (double*) xcalloc(ct, sizeof(double));
+ polybufz = (double*) xcalloc(ct, sizeof(double));
}
gbuint8 NL[2] = { 0x0D, 0x0A };
gbuint8 MSG_START[2] = { 0xA0, 0xA1 };
-gbuint8 SECTOR_READ_END[13] = "END\0CHECKSUM=";
+gbuint8 SECTOR_READ_END[] = "END\0CHECKSUM=";
static int
skytraq_calc_checksum(const unsigned char *buf, int len)
}
db(2, "Receiving message with %i bytes of payload (expected >=%i)\n", rcv_len, len);
- rd_buf(payload, MIN(rcv_len, len));
+ rd_buf((const unsigned char*) payload, MIN(rcv_len, len));
- calc_cs = skytraq_calc_checksum(payload, MIN(rcv_len, len));
+ calc_cs = skytraq_calc_checksum((const unsigned char*) payload, MIN(rcv_len, len));
for (i = 0; i < rcv_len-len; i++) {
c = rd_char(&errors);
calc_cs ^= c;
}
struct read_state {
- route_head *route_head;
+ route_head *route_head_;
unsigned wpn, tpn;
time_t ts;
track->rte_desc = xstrdup("SkyTraq GPS tracklog data");
track_add_head(track);
- pst->route_head = track;
+ pst->route_head_ = track;
pst->wpn = 0;
pst->tpn = 0;
waypt_add(waypt_dupe(tpt));
}
- if (0 == pst->route_head) {
+ if (0 == pst->route_head_) {
db(1, MYNAME ": New Track\n");
- pst->route_head = route_head_alloc();
- track_add_head(pst->route_head);
+ pst->route_head_ = route_head_alloc();
+ track_add_head(pst->route_head_);
}
- track_add_wpt(pst->route_head, tpt);
+ track_add_wpt(pst->route_head_, tpt);
}
return res;
return;
}
- list = (void *)xmalloc(count * sizeof(*list));
+ list = (waypoint**)xmalloc(count * sizeof(*list));
index = 0;
QUEUE_FOR_EACH(&trackpts, elem, tmp) {
ff_type_file,
{
ff_cap_none,
- ff_cap_read | ff_cap_write,
- ff_cap_read | ff_cap_write
+ (ff_cap)(ff_cap_read | ff_cap_write),
+ (ff_cap)(ff_cap_read | ff_cap_write)
},
rd_init,
wr_init,
what = STM_NOTHING;
buff = gbfgetstr(fin);
- buff = (buff == NULL) ? "" : buff;
+ buff = (buff == NULL) ? (char *) "" : buff;
if (case_ignore_strncmp(buff, "Datum,WGS 84,WGS 84,", 20) != 0) {
fatal(MYNAME ": Invalid GPS datum or not \"WaypointPlus\"\" file!\n");